package com.hunliji.monitor.share.enums;

/**
 * 严重程度
 * @author lejin
 */
public enum SeverityEnum {
    /**
     * 仅报告
     */
    ONLY_REPORT(2, "仅报告"),
    /**
     * 低
     */
    LOW(4, "低"),
    /**
     * 中
     */
    MEDIUM(6, "中"),
    /**
     * 高
     */
    HIGH(8, "高"),
    /**
     * 严重
     */
    SERIOUS(10, "严重"),
    ;

    private final Integer code;
    private final String msg;

    SeverityEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static SeverityEnum getByCode(Integer code){
        SeverityEnum[] severityEnums = SeverityEnum.values();
        for (SeverityEnum severityEnum:severityEnums){
            if(severityEnum.getCode().equals(code)){
                return severityEnum;
            }
        }
        return null;
    }
}
